$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'");
if (!$user) { // seems s/he's not, so let's register
$user_ip = '127.0.0.1';
$user_domain = 'localhost';
$user_browser = 'server';
$user_joindate = '1979-06-06 00:41:00'; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
$user_login = addslashes($post_author);
$pass1 = addslashes('password');
$user_nickname = addslashes($post_author);
$user_email = addslashes('user@wordpress.org');
$user_url = addslashes('');
$user_joindate = addslashes($user_joindate);
$result = $wpdb->query("
INSERT INTO $wpdb->users (
user_login,
user_pass,
user_nickname,
user_email,
user_url,
user_ip,
user_domain,
user_browser,
user_registered,
user_level,
user_idmode
) VALUES (
'$user_login',
'$pass1',
'$user_nickname',
'$user_email',
'$user_url',
'$user_ip',
'$user_domain',
'$user_browser',
'$user_joindate',
'1',
'nickname'
)");
echo ": Registered user <strong>$user_login</strong>";
}
$post_author_ID = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'");
$post_date = explode(' ', $post_date);
$post_date_Ymd = explode('/', $post_date[0]);
$postyear = $post_date_Ymd[2];
$postmonth = zeroise($post_date_Ymd[0], 2);
$postday = zeroise($post_date_Ymd[1], 2);
$post_date_His = explode(':', $post_date[1]);
$posthour = zeroise($post_date_His[0], 2);
$postminute = zeroise($post_date_His[1], 2);
$postsecond = zeroise($post_date_His[2], 2);
if (($post_date[2] == 'PM') && ($posthour != '12'))
$posthour = $posthour + 12;
else if (($post_date[2] == 'AM') && ($posthour == '12'))
$dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $wpdb->posts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A);
if ($dupcheck[0]['ID']) {
print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
<h1>Blogger to <img src="../wp-images/wpminilogo.png" width="50" height="50" border="0" alt="WordPress" align="top" /></h1>
<p>This is a basic Blogger to WordPress import script.</p>
<p>What it does:</p>
<ul>
<li>Parses your archives to retrieve your blogger posts.</li>
<li>Adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'</li>
</ul>
<p>What it does not:</p>
<ul>
<li>It sucks at making coffee.</li>
<li>It always forgets to call back.</li>
</ul>
<h2>First step: Install WordPress</h2>
<p>Install the WordPress blog as explained in the <a href="../readme.html">read me</a>, then immediately come back here.</p>
<h3>Second step: let's play with Blogger</h3>
<p>Log into your Blogger account.<br />
Go to the Settings, and make Blogger publish your files in the directory where your WordPress resides. Change the Date/Time format to be mm/dd/yyyy hh:mm:ss AM/PM (the first choice in the dropdown menu). In Archives: set the frequency to 'monthly' and the archive filename to 'wordpress.php' (without the quotes), set the ftp archive path to make Blogger publish the archives in your WordPress directory. Click 'save changes'.<br />
Go to the Templates. Replace your existing template with this line (copy and paste):
Go to the Archives, and click 'republish all'.<br />
Check in your FTP that you've got the archive files published. They should look like this example: <code>2001_10_01_wordpress.php</code>. If they aren't there, redo the republish process.</p>